global.cdn = '//project.com/phaser/game-shoot-ship';
global.config = "dev";
const path = require('path');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const merge = require('webpack-merge');
const Basics = require('./webpack.config.basic.js');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');

module.exports = merge(Basics, {
    // 模式
    mode: 'development',

    // 模块(Module)
    module: {
        rules: [{
            //指定 loader 种类,可能的值有：'pre' | 'post'
            enforce: 'pre',
            test: /\.(js|jsx)$/,
            exclude: /node_modules\/|plugins\//,
            use: [{
                loader: 'eslint-loader',
                options: {
                    fix: true
                }
            }]
        }]
    },

    // 插件
    plugins: [
        new CleanWebpackPlugin([global.dist + "/js/*.chunk.*", global.dist + "/css/*.chunk.*"], {
            root: '',
            verbose: true,
            dry: false
        }),

        // 设置图片资源cdn
        new webpack.DefinePlugin({
            assets_cdn:JSON.stringify("")
        }),

        new CaseSensitivePathsPlugin()
    ],

    // 统计信息
    stats: {
        env: true,
        chunks: false,
        modules: false
    }
});
